package com.minyifang.wcspf.common.utils;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.RequestOptions;
import com.minyifang.wcspf.R;

/**
 * Created by LuoYaWei on 2018/7/11.
 */
public class ImageUtils {

    private static final ImageUtils INSTANCE = new ImageUtils();
    private RequestOptions mRequestOptions;

    {
        mRequestOptions = new RequestOptions();
        mRequestOptions.diskCacheStrategy(DiskCacheStrategy.RESOURCE);
//                .placeholder(R.mipmap.img_place_holder)
//                .error(R.mipmap.img_load_error);
    }

    public static ImageUtils getInstance() {
        return INSTANCE;
    }

    public void showImage(String url, ImageView imageView) {
        Glide.with(imageView.getContext()).load(url)
                .apply(mRequestOptions).into(imageView);
    }
}
